package com.aisile.admin.controller;

import com.aisile.admin.AdSensitiveControllerApi;
import com.aisile.admin.service.AdSensitiveService;
import com.aisile.model.admin.dtos.SensitiveDto;
import com.aisile.model.admin.pojos.AdSensitive;
import com.aisile.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/api/v1/adsensitive") //接口地址
public class AdSensitiveController implements AdSensitiveControllerApi {

    @Autowired
    private AdSensitiveService adSensitiveService;

    /**
     * 分页条件查询
     * @param dto
     * @return
     */
    @PostMapping("/list")
    @Override
    public ResponseResult findPageAdSensitive(@RequestBody SensitiveDto dto) {
        return adSensitiveService.findByPage(dto);
    }

    /**
     * 添加敏感词
     * @param adSensitive
     * @return
     */
    @PostMapping("/save")
    @Override
    public ResponseResult saveAdSensitive(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.saveAdSensitive(adSensitive);
    }

    /**
     * 修改敏感词
     * @param adSensitive
     * @return
     */
    @PutMapping("/updata")
    @Override
    public ResponseResult upAdSensitive(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.updateAdSensitive(adSensitive);
    }

    /**
     * 删除敏感词
     * @param id
     * @return
     */
    @DeleteMapping("/del/{id}")
    @Override
    public ResponseResult delAdSensitive(@PathVariable Integer id) {
        return adSensitiveService.delAdSensitive(id);
    }
}
